﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XWG.JWBST.ProcessInterfaces;
using System.IO;
using System.Web;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using XWG.Framework.AuthUtility;

namespace XWG.JWBST.DelCarInfoProcess
{
    /// <summary>
    /// 删除审核失败车辆信息
    /// </summary>
     public class Process : IProcess
    {
         public string ProcessData(StreamReader reader, HttpContext context)
         {
             string info = reader.ReadToEnd();
             info = HttpUtility.UrlDecode(info);
             JObject oka = (JObject)JsonConvert.DeserializeObject(info);
             string id = oka["CarID"].ToString().Replace("\"", string.Empty);
             var carinfo = XWG.JWBST.JWBSTBLL.TbBstCarBLL.Load(id);
             if (carinfo.Isaudit == "2")
             {
                 carinfo.Isdel = "1";
                 ResultModel re = new ResultModel();
                 re = XWG.JWBST.JWBSTBLL.TbBstCarBLL.Update(carinfo,"",false);
                 //re = XWG.JWBST.JWBSTBLL.TbBstCarBLL.Delete(id, "", false);
                 return re.Message;
             }
             else
             {
                 return "该车已通过审核或尚未审核";
             }
         }
    }
}
